Databases are used to store information for an innumerable number of applications, including various commercial, industrial, technical, scientific and educational applications. As the reliance on information increases, both the volume of information stored in most databases, as well as the number of users wishing to access that information, likewise increases. Moreover, as the volume of information in a database, and the number of users wishing to access the database, increases, the amount of computing resources required to manage such a database increases as well.
Database management systems (DBMS's), which are the computer programs that are used to access the information stored in databases, therefore often require tremendous resources to handle the heavy workloads placed on such systems. As such, significant resources have been devoted to increasing the performance of database management systems with respect to processing searches, or queries, to databases.
Improvements to both computer hardware and software have improved the capacities of conventional database management systems. For example, in the hardware realm, increases in microprocessor performance, coupled with improved memory management systems, have improved the number of queries that a particular microprocessor can perform in a given unit of time. Furthermore, the use of multiple microprocessors and/or multiple networked computers has further increased the capacities of many database management systems.
From a software standpoint, the use of relational databases, which organize information into formally-defined tables consisting of rows and columns, and which are typically accessed using a standardized language such as Structured Query Language (SQL), has substantially improved processing efficiency, as well as substantially simplified the creation, organization, and extension of information within a database. Furthermore, significant development efforts have been directed toward query “optimization”, whereby the execution of particular searches, or queries, is optimized in an automated manner to minimize the amount of resources required to execute each query.
Through the incorporation of various hardware and software improvements, many high performance database management systems are able to handle hundreds or even thousands of queries each second, even on databases containing millions or billions of records. However, further increases in information volume and workload are inevitable, so continued advancements in database management systems are still required.
Presently, there are cost-based query optimizers and rule-based query optimizers. In a rule-based environment, a user, such as a skilled database administrator, explicitly defines a number of rules of how to generate an access plan from an SQL statement. These rules, for example, can relate to creating or using indices or can relate to how JOIN statements are performed. The rule-based optimizer applies the rules as specified by the user to generate an access plan in accordance with the rules. The performance of the resulting access plan is determined by the skill of the user specifying the rules.
A cost-based optimizer includes information of the many alternative ways that an exemplary SQL statement can be converted into an access plan. An estimate is generated for each such alternative plan as to its anticipated performance “cost”. The cost-based optimizer attempts to identify the access plan having the lowest cost. One area that has been a fertile area for academic and corporate research is that of improving the designs of the cost-based “query optimizers” utilized in many conventional database management systems. As stated, the primary task of a query optimizer is to choose the most efficient way to execute each database query, or request, passed to the database management system by a user. The output of an optimization process is typically referred to as an “execution plan,” “access plan,” or just “plan” and is frequently depicted as a tree graph. Such a plan typically incorporates (often in a proprietary form unique to each optimizer/DBMS) low-level information telling the database engine that ultimately handles a query precisely what steps to take (and in what order) to execute the query. Also typically associated with each generated plan is an optimizer's estimate of how long it will take to run the query using that plan.
A cost-based optimizer's job is often necessary and difficult because of the enormous number (i.e., “countably infinite” number) of possible query forms that can be generated in a database management system, e.g., due to factors such as the use of SQL queries with any number of relational tables made up of countless data columns of various types, the theoretically infinite number of methods of accessing the actual data records from each table referenced (e.g., using an index, a hash table, etc.), the possible combinations of those methods of access among all the tables referenced, etc. A cost-based optimizer is often permitted to rewrite a query (or portion of it) into any equivalent form, and since for any given query there are typically many equivalent forms, an optimizer has a countably infinite universe of extremely diverse possible solutions (plans) to consider. On the other hand, an optimizer is often required to use minimal system resources given the desirability for high throughput. As such, a cost-based optimizer often has only a limited amount of time to pare the search space of possible execution plans down to an optimal plan for a particular query.
Typical cost-based optimizers store information about previously encountered queries and the access plans that were created for such queries. When a previous query is once again encountered, these optimizers use previous access plans to avoid the time and cost of re-creating an access plan. However, even if a similar query is used, there may be different needs or requirements for the data being retrieved. Current cost-based optimizers, therefore, produce the same access plan for all users and do not permit the access plans to be modified or customized. Thus, there remains the need in prior database environments for a system that permits customization of an access plan generated by a cost-based optimizer.